package model;
/**
 *
 * @author Raphael & Phillipp
 */
public class Module {
    
    public Course[] courses = new Course[3];
    public int credits;
    
    void addCourseToModule(Course course){
        for (int i=0; i<courses.length; i++){
            if(courses[i] != null){
                courses[i] = course;
                break;
            }  
        }
    }
    
    //different constructors for different mappings
    //when calling constructor, check credits !
     public Module(Course course1){
         addCourseToModule(course1);
         credits = course1.getCredits(); 
    }
    public Module(Course course1, Course course2){
          addCourseToModule(course1);
          addCourseToModule(course2);
          credits = course1.getCredits() + course2.getCredits();
    }
    
    public Module(Course course1, Course course2, Course course3){
        addCourseToModule(course1);
        addCourseToModule(course2);
        addCourseToModule(course3);
        credits = course1.getCredits() + course2.getCredits() + course3.getCredits();
    }
    
    //Standard getter und setter
    
    public int getCredits() {
        return credits;
    }
    public void setCredits(int credits) {
        this.credits = credits;
    }
    public Course[] getCourses() {
        return courses;
    }  
}